package com.demo;

import java.io.File;

public class Demo01 {
    public static void main(String[] args) {
        File file1 = new File("D:\\upload");
        File file2 = new File("D:\\upload\\1.txt");
        File file3 = new File("Demo02.java");
        System.out.println(file1);
        System.out.println(file2);
        //File类的信息获取
        //获取文件的绝对路径
        String absPath2 = file2.getAbsolutePath();
        String absPath3 = file3.getAbsolutePath();
        //获取该File类中封装的路径
        String path2 = file2.getPath();
        String path3 = file3.getPath();
        //获取文件名称
        String fileName = file2.getName();
        //获取文件字节大小
        Long size = file2.length();
        System.out.println();
    }
}
